import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:honeypotflutter/public/views/public_appBar.dart';
import 'package:honeypotflutter/public/views/public_scrollView.dart';
import 'package:honeypotflutter/router/bussine_router_url.dart';
import '../../model/deliver_result.dart';
import '../../views/deliver_result_button.dart';
import '../../views/deliver_result_header.dart';
import '../deliver_select/view.dart';
import 'logic.dart';

class DeliverCancelPage extends StatefulWidget {
  const DeliverCancelPage({Key? key}) : super(key: key);

  @override
  State<DeliverCancelPage> createState() => _DeliverCancelPageState();
}

class _DeliverCancelPageState extends State<DeliverCancelPage> {
  final DeliverCancelLogic logic = Get.put(DeliverCancelLogic());
  late DeliverResult result;
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    result = Get.arguments;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: HLAppBar(
        navigationTitle: "取消投递",
        showBottomLine: true,
        showBackLeading: false,
      ),
      body: HLScrollView(
        padding: EdgeInsets.only(left: 35, right: 35, top: 40),
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          DeliverResultHeader(
            status: "取消成功",
            remind: "${result.displayAlias}柜门已打开，请取出包裹后关门",
          ),
          SizedBox(height: 30),
          DeliverResultButton(
            firstTitle: "继续投递",
            firstAction: () {
              Get.off(DeliverSelectPage(), arguments: true);
            },
            threeTitle: "返回首页",
            threeAction: () {
              Get.offAll(MGRouterUrl.index);
            },
          )
        ],
      ),
    );
  }

  @override
  void dispose() {
    Get.delete<DeliverCancelLogic>();
    super.dispose();
  }
}
